
   <html>
   <head>
   <style type=text/css>
   body { font-size: 10pt; font-family: Arial; }
   </style>
   </head>
   <body>
   
</br>
<font color="darkred">#include</font>&nbsp;&lt;coelacanth/str.h&gt;</br>
</br>
<font color="darkgreen">int</font>&nbsp;main()</br>
{</br>
&nbsp;&nbsp;&nbsp;<font color="darkgreen">char</font>&nbsp;buffer[16]&nbsp;=&nbsp;"";</br>
</br>
&nbsp;&nbsp;&nbsp;/*&nbsp;test&nbsp;str_split()&nbsp;*/</br>
&nbsp;&nbsp;&nbsp;puts("&nbsp;--&nbsp;str_split()&nbsp;--");</br>
&nbsp;&nbsp;&nbsp;<font color="darkgreen">char</font>&nbsp;*str&nbsp;=&nbsp;"root:x:0:0:root:/root:/bin/bash";</br>
</br>
&nbsp;&nbsp;&nbsp;while((str&nbsp;=&nbsp;str_split(str,&nbsp;":",&nbsp;buffer,&nbsp;sizeof(buffer))))</br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pr<font color="darkgreen">int</font>f("%s\n",&nbsp;buffer);</br>
&nbsp;&nbsp;&nbsp;pr<font color="darkgreen">int</font>f("%s\n",&nbsp;buffer);</br>
</br>
&nbsp;&nbsp;&nbsp;str&nbsp;=&nbsp;"hi-|-how";</br>
&nbsp;&nbsp;&nbsp;str&nbsp;=&nbsp;str_split(str,&nbsp;"-|-",&nbsp;buffer,&nbsp;sizeof(buffer));</br>
&nbsp;&nbsp;&nbsp;pr<font color="darkgreen">int</font>f("%s\n",&nbsp;buffer);</br>
&nbsp;&nbsp;&nbsp;str&nbsp;=&nbsp;str_split(str,&nbsp;"-|-",&nbsp;buffer,&nbsp;sizeof(buffer));</br>
&nbsp;&nbsp;&nbsp;pr<font color="darkgreen">int</font>f("%s\n",&nbsp;buffer);</br>
</br>
</br>
&nbsp;&nbsp;&nbsp;/*&nbsp;test&nbsp;str_trim&nbsp;*/</br>
&nbsp;&nbsp;&nbsp;puts("&nbsp;--&nbsp;str_trim()&nbsp;--");</br>
&nbsp;&nbsp;&nbsp;snpr<font color="darkgreen">int</font>f(buffer,&nbsp;sizeof(buffer),&nbsp;"\n&nbsp;Hello&nbsp;World!\t&nbsp;");</br>
&nbsp;&nbsp;&nbsp;str_trim(buffer);</br>
&nbsp;&nbsp;&nbsp;pr<font color="darkgreen">int</font>f("%s\n",&nbsp;buffer);</br>
</br>
&nbsp;&nbsp;&nbsp;/*&nbsp;test&nbsp;str_replace&nbsp;*/</br>
&nbsp;&nbsp;&nbsp;puts("&nbsp;--&nbsp;str_replace()&nbsp;--");</br>
&nbsp;&nbsp;&nbsp;snpr<font color="darkgreen">int</font>f(buffer,&nbsp;sizeof(buffer),&nbsp;"hola&nbsp;que&nbsp;tal");</br>
&nbsp;&nbsp;&nbsp;str_replace(buffer,&nbsp;sizeof(buffer),&nbsp;"a",&nbsp;"A");</br>
&nbsp;&nbsp;&nbsp;pr<font color="darkgreen">int</font>f("%s\n",&nbsp;buffer);</br>
&nbsp;&nbsp;&nbsp;str_replace(buffer,&nbsp;sizeof(buffer),&nbsp;"A",&nbsp;"OOO");</br>
&nbsp;&nbsp;&nbsp;pr<font color="darkgreen">int</font>f("%s\n",&nbsp;buffer);</br>
&nbsp;&nbsp;&nbsp;str_replace(buffer,&nbsp;sizeof(buffer),&nbsp;"o",&nbsp;"XXXXXXXXXXXXXXXXX");</br>
&nbsp;&nbsp;&nbsp;pr<font color="darkgreen">int</font>f("%s\n",&nbsp;buffer);</br>
&nbsp;&nbsp;&nbsp;</br>
&nbsp;&nbsp;&nbsp;<font color="#6d4d00">return</font>&nbsp;0;</br>
}</br>
</br>
</br>
</body></html>
